1. (20 points) Answer the following questions as follows:

1.1. Naive Bayes algorithm assumes the feature independence. TRUE or FALSE? and Why?

Answer

It is True:

image.png

1.2. The functions f and g are both concave functions of a single variable. Neither function is necessarily differentiable. Is the function h defined by h(x) = f(x) +g(x) necessarily concave, necessarily convex, or not necessarily either ?

Answer

h(x) is the same as f(x) and g(x), they are all concave functions.

1.3. Find the angle between these two vectors, u = (6,2), and v = (5,−2).

Answer

image.png

1.4. Suppose we were interested in determining if there were differences in the average prices among two automobile companies. We randomly pick ten cars to compare at both companies. Which statistical procedure would be best to use for this study and why?

Answer

We can apply hypothesis testing on two sets of samples to test whether they are independent or related no matter what PDF do they obey. Before start a parametric hypothesis testing, we need to know the statistic mean of the sample set. But Central Limit Theorem holds especially true for sample sizes over 30. So the sample size should be noticed because there are not enough observations on both RV: each of them contains ten observations. As a result, non-parametric hypothesis testing should be considered.

Considering two sets of car prices as two sequences and applying Mann-Whitney Test of Independence is a good hypothesis testing opinion on both equal or unequal size of sample sets.

2. (20 points)

Assume that when deciding whether an applicant is low-risk (c0), medium-risk (c1), or high-risk (c2) for bank loans, the bank only considers the amount of money in the saving accounts of the applicants. Historic data indicate following distribution about the savings (in thousand dollars) of the applicant based on their classes:

(x|c0) ∼ Uniform(35,60), (x|c1) ∼ Uniform(15,45), (x|c2) ∼ Uniform(0,20)

Furthermore, we know that 20% and 30% of the previous applicants are low-risk and medium-risk, respectively. If an applicant has 48,000 dollars in her savings account, predict the applicant’s class (based on Bayes decision rules).

Hint: pdf for uniform distribution — if x ∼ Uni f orm(a,b), f(x) = 1/(b−a) f or a <= x <= b.

Answer

$\color{red}{\text{P(c0|x)=0.336}}$

$\color{red}{\text{P(c1|x)=0.332}}$

$\color{red}{\text{P(c2|x)=0.332}}$

image-4.png

image-6.png

for:

image-5.png

image-7.png

3. (20 points) Let $f(x) = x^3 +6x+5$

3.1 Compute f′(x), f′′(x), and determine whether f convex, concave, or neither.

Answer

as we know:

$f′(x) = 3x^2 + 6$

$f′′(x) = 6x $

$f''(x)>0,\ when\ x>0\ \therefore$ f(x) is convex at x when $x>0$

$f''(x)<0,\ when\ x<0\ \therefore$ f(x) is concave at x when $x<0$

3.2 Optimize the following function by finding the critical value(s) at which the function is optimized.

(Hint :To find the critical values put $f ′(x) = 0$)

Answer

critical values are at $f ′(x) = 0$

$f ′(x) = 3x^2 + 6 = 0$

$ x^2 = -2$

$ x = \pm\sqrt{2}i$

4. (20 points) Consider the following table as a training data for Naive Bayes classifier. Find the following probabilities. Apply Laplace correction if required.

image.png

4.1 P(Label = Yes|A = 1,B = 1,C = 0)

Answer

image.png

image-2.png

4.2 P(Label = No|A = 1,B = 0,C = 0)

Answer

image.png

image-2.png

5. (20 points) Consider the pdf of f(x) and calculate the following :

image.png

5.1. find the value of c

Answer

c>0 in order to maintain f(x)>0

let c be 1 as simplify

5.2. CDF of f(x)

Answer

Let c be 1, then CDF of f(x) will be:

image-2.png

5.3. find P(X ≥ 1/2)

Answer

$\color{red}{\text{the answer is :}}$ $\frac{15}{16}$

image.png